import React from 'react';
import Button from './button'
class List2 extends React.Component {
  render() {
    let { data, onDel } = this.props;
    return <div className=''>
      <ul>
        {
          data.map(item => <li key={item.id}>{item.text} <Button onClick={() => {
            onDel(item.id)
          }}>X</Button></li>)
        }
      </ul>
    </div>;
  }
}
function List(props) {
  let { data, onDel } = props;
  return <div className=''>
    <ul>
      {
        data.map(item => <li key={item.id}>{item.text} <Button onClick={() => {
          onDel(item.id)
        }}>X</Button></li>)
      }
    </ul>
  </div>;
}
export default List